package com.qkst.website.backstage.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.qkst.website.backstage.bean.AttrBean;
import com.qkst.website.backstage.mapper.AttrMapper;
import com.qkst.website.backstage.service.AttrService;
/**
 * @author lh
 * @description 产品属性service 业务处理层
 * @date 2017-05-04
 * @email ahlxlihao@163.com
 *
 */
@Service("attrService")
@Transactional
public class AttrServiceImpl implements AttrService {
	@Resource(name = "attrMapper")
	private AttrMapper attrMapper;

	/**
	 * 获取属性
	 * @param attr
	 * @return List<AttrBean>
	 */
	
	@Override
	public List<AttrBean> list(AttrBean attrBean) {
		return attrMapper.selectAttrs(attrBean);
	}
	/**
	 * 保存属性
	 * @param attrBean
	 * @return AttrBean
	 */
	@Override
	public AttrBean save(AttrBean attrBean) {
		attrMapper.insert(attrBean);
		return attrBean;
	}
	
	/**
	 * 删除属性
	 * @param attrBean
	 * @return boolean
	 */
	@Override
	public boolean delete(AttrBean attrBean) {
		int num=attrMapper.deleteByPrimaryKey(attrBean.getAttrId());
		if(num>0){
			return true;
		}
		return false;
	}

}
